﻿package fullHistory
{
	
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import fullHistory.events.EventData;
	import game.exchangeddata.HashTable;
	import fullHistory.GlobalVariables;
	/**
	 * ...
	 * @author Doan Nguyen Thuy Nha Truc (BamBoo)
	 */
	public class LoginPanel extends MovieClip
	{
		public var txtTitleLoginTf:TextField;
		public var txtUserTf:TextField;
		public var txtPassTf:TextField;
		public var txtLoginTf:TextField;
		public var btnLogin:MovieClip;
		public var txtUserTi:TextField;
		public var txtPassWordTi:TextField;
		
		
		public function LoginPanel() 
		{
			this.btnLogin.addEventListener(MouseEvent.CLICK, hdlLogin);
			this.txtLoginTf.mouseEnabled = false;
			this.btnLogin.buttonMode = true;
			txtUserTi.tabIndex = 1;
			txtPassWordTi.tabIndex = 2;
			btnLogin.tabIndex = 3;
		}
		
		private function hdlLogin(e:MouseEvent):void 
		{
			if (txtUserTi.text != "" && txtPassWordTi.text != "") {
				
				GlobalVariables.userName  = txtUserTi.text;
				GlobalVariables.userPass = txtPassWordTi.text;
				dispatchEvent(new EventData(EventData.CALL_LOGIN, true));
			}else{
				trace("RequireUserIdPassword");
			}
			trace("mmmmmmmmmmmmmmmmm");
		}
		
	
		
		public function initText(hashTableInfo:HashTable):void {
			this.txtTitleLoginTf.text = hashTableInfo.lookupString("Lologin");
			this.txtUserTf.text = hashTableInfo.lookupString("Lousername");
			this.txtPassTf.text = hashTableInfo.lookupString("Lopassword");
			this.txtLoginTf.text = hashTableInfo.lookupString("Lologin");
			
			
		}
		
		
	}

}